library(variableStars)
library(data.table)
library(ggplot2)
library(ggsci)
library(microbenchmark)
library(RColorBrewer)

Data source

if (T) {
  dt.star <- data.frame(read.table("../data/table1.dat", sep = "\t"))
  colnames(dt.star) <- c("Seq","frequency","amplitude","Phase","Sig","S/N","rms","e_Freq","e_Amp","e_Phase")
} else {
  dt.star <- data.frame(read.table("../data/freqs.dat", sep = " "))
  colnames(dt.star) <- c("Id","frequency","Freq2","amplitude","Phase","Sig", "S/N","rms", "e_Freq1","e_Amp","e_Phase")
}
head(dt.star)

# Save Data to disk (to be replicated)
write.table(
  dt.star[c("frequency", "amplitude")],
  file = "/tmp/data.csv",
  sep = "\t",
  quote = F,
  row.names = F,
  col.names = F
)

Data gathering from the Antonio's PhD thesis.

Frequencies and amplitudes

plot_spectrum_ggplot(-5, 80, dt.star)

Experiment execution

result <- process(
  dt.star$frequency,
  dt.star$amplitude,
  filter = "uniform",
  gRegimen = 0,
  minDnu = 15,
  maxDnu = 95,
  dnuValue = -1,
  dnuGuessError = 10,
  dnuEstimation = TRUE,
  numFrequencies = 30,
  debug = TRUE
)

Apodization

# Plot frecuency and amplitude
plot_apodization_ggplot(
  data.frame(
    "frequences" = result$apodization$frequences,
    "amplitude" = result$apodization$amp
  )
)

Periodicities

dt <- prepare_periodicities_dataset(result$fresAmps)
plot_periodicities_ggplot(dt)

Histogram of differences

dt <- data.frame(result$diffHistogram$histogram)
plot_histogram_ggplot(dt)

Autocorrelation

dt <- data.frame(result$crossCorrelation)
plot_crosscorrelation_ggplot(dt)

Echelle

For first all frecuencies

dt <- data.frame(
  "x" = result$echelle$modDnuStacked,
  "y" = result$echelle$freMas,
  "h" = result$echelle$amplitudes
)
plot_echelle_ggplot(dt) 

For first 30 frecuencies

dt <- data.frame(
  "x" = result$echelleRanges$`30`$modDnuStacked,
  "y" = result$echelleRanges$`30`$freMas,
  "h" = result$echelleRanges$`30`$amplitudes
)
# Plot echelle
plot_echelle_ggplot(dt) 

Computation benchmark

# m <-
#   microbenchmark(result <- process(
#   dt.star$frequency,
#   dt.star$amplitude,
#   filter = "uniform",
#   gRegimen = 0,
#   minDnu = 15,
#   maxDnu = 95,
#   dnuValue = -1,
#   dnuGuessError = 10,
#   dnuEstimation = TRUE,
#   numFrequencies = 30,
#   debug = F
# )
#                  ,times = 100)
# autoplot(m, log = F) +
#   scale_x_discrete(labels = c("The complete process")) +
#   xlab("")


rmaestre/variableStars documentation built on April 11, 2020, 11:10 p.m.